<template>
  <div>
    <span v-for="item in arr" :key="item"
      ><input type="checkbox" :value="item" v-model="arr1" /> {{ item }}
    </span>
    <h3>你选中的数字，和为：{{ sum(arr1) }}</h3>
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr1: [],
      arr: [9, 15, 19, 25, 29, 31, 48, 57, 62, 79, 87],
    };
  },
  methods: {
    sum(a) {
      return a.length ? eval(a.join("+")) : 0;
    },
  },
  computed: {},
};
</script>
